import dayjs from 'dayjs'
import {FunctionComponent, useEffect} from 'react'
import{Button} from 'antd'
import './Home.css'
import store from '../../store/store'

interface Props{
  value:string,
  title:string
}
export const Home:FunctionComponent<Props>=({value,title})=>{
  const {personStore} =store
  useEffect(()=>{
    console.log(value);
    console.log(combination([1,2,3,4]));
  },[])
  const btnHandler=():void=>{
    console.log('21212');
    personStore.updata_birthday('2000-2-22'+dayjs().format("HH:mm"))
  }
  
  const combination=(arr:Array<number>):Array<number>=>{
      const result:Array<any>=[[]]
      const cur:Array<any>=[]
      const fn=(num:number)=>{
        for(let i= num;i<arr.length;i++){         
          cur.push(arr[i]);
          result.push([...cur])          
          fn(i+1)
          cur.pop();
        }
      }
      fn(0)
      return result
  }
  return (<>
  <h1>{title}</h1>
  <Button type='primary' onClick={btnHandler}>点击+1</Button>
  <h2>测试flex效果</h2>
  <div className='layout-flex'>
    <div className='item1'>粉金测试测试测试</div>
    <div className='item2'>黑色</div>
    <div className='item3'>银白固定宽度</div>
    <div className='item4'>固定宽度</div>
  </div>
</>)
    
  
}
